﻿using System;
using System.Collections.Generic;
using System.Data;

namespace ApplicationTemplate
{
    class CreateDacSelectAPI
    {
        public static String CreateSelect(String realTableName, String modelClassName, DataSet FieldsDs, String DAMInstanceName)
        {
            String tableName = ApplcationTemplate.GetTableName(realTableName);
            return String.Format(
@"public DataSet Get{0}Info({1} model, DBManager dbManager)
        {{
            return {2}.Get{0}Info(model, dbManager);
        }}",
            tableName,
            modelClassName,
            DAMInstanceName);
        }

        public static String CreateSelectNoDbManager(String realTableName, String modelClassName, DataSet FieldsDs, String DAMInstanceName)
        {
            String tableName = ApplcationTemplate.GetTableName(realTableName);
            return String.Format(
@"public DataSet Get{0}Info({1} model)
        {{
            return {2}.Get{0}Info(model, null);
        }}",
            tableName,
            modelClassName,
            DAMInstanceName);
        }


        public static String CreateSelectAll(String realTableName, String modelClassName, DataSet FieldsDs, String DAMInstanceName)
        {
            String tableName = ApplcationTemplate.GetTableName(realTableName);
            return String.Format(
@"public DataSet GetAll(DBManager dbManager)
        {{
            return {0}.GetAll(dbManager);
        }}",
            DAMInstanceName);
        }

        public static String CreateSelectAllNoDbManager(String realTableName, String modelClassName, DataSet FieldsDs, String DAMInstanceName)
        {
            String tableName = ApplcationTemplate.GetTableName(realTableName);
            return String.Format(
@"public DataSet GetAll()
        {{
            return {0}.GetAll(null);
        }}",
            DAMInstanceName);
        }

    }
}
